﻿using GdNet.WebFramework.Domain.Common;

namespace GdNet.WebFramework.Domain.System
{
    public partial class Translation
    {
        public static TranslationFactory Factory
        {
            get { return new TranslationFactory(); }
        }

        public class TranslationFactory
        {
            /// <summary>
            /// Create a translation for any language
            /// </summary>
            /// <param name="keyword">Unique keyword of a translation</param>
            public Translation Create(string keyword)
            {
                return this.Create(keyword, LanguagesCode.Any, null);
            }

            /// <summary>
            /// Create a translation with null value
            /// </summary>
            /// <param name="keyword">Unique keyword of a translation</param>
            /// <param name="language">Code of the language, with length is two characters</param>
            public Translation Create(string keyword, string language)
            {
                return this.Create(keyword, language, null);
            }

            /// <param name="keyword">Unique keyword of a translation</param>
            /// <param name="language">Code of the language, with length is two characters</param>
            public Translation Create(string keyword, string language, string value)
            {
                return new Translation()
                {
                    Keyword = keyword,
                    Language = language,
                    Value = value,
                };
            }
        }
    }
}
